home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / utils / file / logiso.000 / logiso / Utils / RCS / ksh_fns,v < prev    next >
Encoding:
Text File  |  1995-03-24  |  1.5 KB  |  84 lines

  1. head    1.2;
  2. access;
  3. symbols
  4.     VER_0_3:1.2
  5.     VER_0_2:1.1;
  6. locks; strict;
  7. comment    @# @;
  8.  
  9.  
  10. 1.2
  11. date    95.03.24.11.43.35;    author coulter;    state Exp;
  12. branches;
  13. next    1.1;
  14.  
  15. 1.1
  16. date    95.02.18.08.36.38;    author coulter;    state Exp;
  17. branches;
  18. next    ;
  19.  
  20.  
  21. desc
  22. @standard ksh functions.  sourced in by various scripts
  23. @
  24.  
  25.  
  26. 1.2
  27. log
  28. @Checkin version for 0.3 distribution.
  29. @
  30. text
  31. @
  32. # (C) Copyright 1995 by Michael Coulter.  All rights reserved.
  33. ##########################################################################
  34. # Functions:
  35.     # check_return expected_value exit_value exit_message
  36.     # check_cmd function: check_cmd exit_status cmd arg...
  37.     # report_error expected_status message
  38.  
  39.     # USAGE: check_return expected_value exit_value exit_message
  40.     function check_return
  41.     {
  42.     RETURN_STATUS=$?
  43.     if [ "$RETURN_STATUS" -ne "$1" ]
  44.     then
  45.         echo "Expected status $1 got ${RETURN_STATUS}." >&2
  46.         echo "$3" >&2
  47.         exit "$2"
  48.     fi
  49.     }
  50.  
  51.     # check_cmd function: check_cmd exit_status cmd arg...
  52.     #
  53.     function check_cmd
  54.     {
  55.         EXIT_STATUS="$1"; shift
  56.         COMMAND="$@@"
  57.         "$@@"
  58.         check_return 0 "$EXIT_STATUS" "Error with command: $COMMAND"
  59.     }
  60.  
  61.     #   report_error expected_status message
  62.     #        if $? is not expecte_status, print message to stderr and
  63.     #        increment NBR_ERRORS
  64.     function report_error
  65.     {
  66.         REPORT_ERROR_STATUS=$?
  67.         if [ $REPORT_ERROR_STATUS -ne "$1" ]
  68.         then
  69.         echo "$2" >&2
  70.         NBR_ERRORS=$$(($NBR_ERRORS + 1))
  71.         fi
  72.     }
  73.     NBR_ERRORS=0
  74. @
  75.  
  76.  
  77. 1.1
  78. log
  79. @Checkpoint version before fixing /usr/bin install
  80. @
  81. text
  82. @d2 1
  83. @
  84.